#ifndef  _UIGLOBAL_H
#define  _UIGLOBAL_H

typedef void (CALLBACK* IMAGELOADPROC)(LPCTSTR lpszPath, LPVOID* lppVoid, int* len);
typedef CControlUI* (_cdecl *CONTROLCREATEPROC)();
class UIRes
{
public:
	virtual void InitResDir(LPCTSTR lpszModuleName, LPCTSTR lpszPath) = 0;
	virtual bool LoadSkin(LPCTSTR lpszFile, LPCTSTR lpszId = NULL, UINT uResType = UIRES_ALL) = 0;
	virtual ImageObj*  LoadImage(LPCTSTR lpszPath, bool bSave = true) = 0;
	virtual ImageObj*  LoadImage(LPVOID lpData, long nSize) = 0;
	virtual HICON LoadIcon(LPCTSTR lpszPath) = 0;
	virtual HICON LoadIcon(LPVOID lpData, long nSize) = 0;
	virtual UIMENUINFO GetMenu( UINT uMenuID, int nIndex = -1, UINT uFlag = BY_POSITION ) = 0;
	virtual void SetLoadImageCallback(IMAGELOADPROC func) = 0;
	virtual void  AdjustHSL(int nHue, int nSaturation, int lightness) = 0;
};

class UIEngine
{
public:
	virtual void InitSkin() = 0;
	virtual void UnInitSkin() = 0;
	virtual void CloseSubWindow() = 0;
	virtual HINSTANCE GetInstanceHandle()= 0;
	virtual DWORD GetOSVersion() = 0;
	virtual void SkinWindow(HWND hWnd, LPCTSTR lpszId) = 0;
	virtual void UnSkinWindow(HWND hWnd) = 0;
	virtual int GetWindowCount() = 0;
	virtual CWindowUI* GetWindow(int nIndex) = 0;
	virtual CWindowUI* GetWindow(HWND hWnd) = 0;
	virtual CWindowUI* GetWindow(LPCTSTR lpszId) = 0;
	virtual CWindowUI* GetWindow(LPCTSTR lpszId, UINT uData) = 0;
	virtual CWindowUI* GetWindow(LPCTSTR lpszId, LPCTSTR lpszSubId) = 0;

	virtual void RegisterControl(LPCTSTR lpszType, CONTROLCREATEPROC lfCreateFn) = 0;
	virtual bool AddControlList(CControlUI* pParent, CControlUI* pNext, LPCTSTR lpszId) = 0;

	virtual void SetDefSkinImage() = 0;
	virtual void SetSkinImage(LPCTSTR lpszPath, int nStretchMode, bool bAnimation = true) = 0;
	virtual LPCTSTR GetSkinImage() = 0;

	virtual int  MessageLoop() = 0;
	virtual bool TranslateMessage(const LPMSG pMsg) = 0;

	virtual void SetAlpha(int nAlpha) = 0;
	virtual int GetAlpha() = 0;

	virtual void AdjustHSL(COLORREF clr = DEFAULT_SKIN_COLOR) = 0;
	virtual void AdjustHSL( int nHue, int nSaturation, int lightness) = 0;
	virtual void GetAdjustHSL( int& nHue, int& nSaturation, int& lightness) = 0;
	virtual COLORREF GetAdjustColor() = 0;
};

extern "C"
{
	DUI_API UIRes*  GetUIRes();
	DUI_API UIEngine*  GetUIEngine();
	DUI_API LPCTSTR I18NSTR(LPCTSTR lpszStr);
};

#endif